package com.niiwoo.civet.base.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * 借款标的类型
 */
@Getter
@AllArgsConstructor
public enum BorrowProjectTypeEnum {
    PERSONAL_SPEEDLOAN((byte) 1, "极速借个人"),
    ORG_SPEEDLOAN((byte) 2, "极速借机构"), // 重构前极速借机构历史数据
    NIIWOO_CLOUD_LOAN((byte) 3, "你我云贷"),
    CARD_NIU_LOAN((byte) 4, "卡易借"),

    XINYONG((byte) -4, "信用借"),  //老系统遗留：4 ————> -4
    QIAOQIAOJIE((byte) -5, "悄悄借"),  //老系统遗留：5 ————> -5
    CASHCAR((byte) -6, "现金动车"), //老系统遗留：6 ————> -6

    SMALL_LOAN((byte) 8, "小易贷"),
    SOCIAL_SECURITY_LOAN((byte) 9, "社保贷"),
    CREDIT_CARD_LOAN((byte) 10, "信用卡贷"),

    ORG_SPEEDLOAN_NEW((byte) 11, "极速借机构"), // 新极速借机构类型

    DECORATION_LOAN((byte) 12,"装修借"),
	
	TRANSFER_OF_CREDIT((byte)13,"债权标"),
	
	CONSUME_LOAN((byte) 14, "消费贷");

    private final Byte value;
    private final String desc;

    public static BorrowProjectTypeEnum enumOf(Byte value) {
        for (BorrowProjectTypeEnum typeEnum : values()) {
            if (typeEnum.value.equals(value)) {
                return typeEnum;
            }
        }
        throw new RuntimeException("标的类型枚举无法转换");
    }

    public static boolean noJump(Byte code) {
        List<Byte> list = new ArrayList<>();
        list.add(BorrowProjectTypeEnum.XINYONG.getValue());
        list.add(BorrowProjectTypeEnum.QIAOQIAOJIE.getValue());
        list.add(BorrowProjectTypeEnum.CASHCAR.getValue());
        list.add(BorrowProjectTypeEnum.ORG_SPEEDLOAN.getValue());

        return list.contains(code);
    }

}
